<pre>

import java.util.List;
import java.util.Map;

import bingosoft.components.base.api.BaseApiController;
import bingosoft.components.base.service.PageQueryRequest;
import bingosoft.components.base.service.Result;
import bingosoft.components.base.service.ResultEntity;
import bingosoft.components.base.service.ResultPage;
import leap.core.annotation.Inject;
import leap.core.annotation.M;
import leap.core.doc.annotation.Doc;
import leap.core.validation.annotations.Required;
import leap.web.annotation.Path;
import leap.web.annotation.http.DELETE;
import leap.web.annotation.http.GET;
import leap.web.annotation.http.PATCH;
import leap.web.annotation.http.POST;
import leap.web.api.mvc.ApiResponse;
import leap.web.api.mvc.params.QueryOptions;
import leap.web.json.JsonSerialize;

/**
 * @author ${author}
 * @功能描述 ${table.tableComment}服务API
 * @创建时间 ${date}
 */
@Path("/${table.humpTableName}")
@JsonSerialize(dateFormat = "yyyy-MM-dd HH:mm:ss")
public class ${table.capitalTableName}Controller extends BaseApiController{
	
	/**
	 * ${table.tableComment}业务服务接口
	 */
	@Inject @M
	protected I${table.capitalTableName}Service ${table.humpTableName}Service;
	
	/**
	 * 构建函数
	 */
	public ${table.capitalTableName}Controller(){
		this.setLogClass(getClass());
	}
	
	@SuppressWarnings("unchecked")
	@GET
	@Doc("分页查询${table.tableComment}")
	/**
	 * 分页查询${table.tableComment}
	 * @param pageQueryRequest 查询选项
	 * @return ${table.tableComment}列表
	 */
	public ApiResponse&lt;ResultPage&lt;List&lt;${table.capitalTableName}Form&gt;&gt;&gt; pageQuery${table.capitalTableName}s(@Doc("查询选项") PageQueryRequest pageQueryRequest){
		this.logMethodCalled("pageQuery${table.capitalTableName}s");
		this.logParamValue("pageQueryRequest", pageQueryRequest);
		
		Map&lt;String, Object&gt; params = null;
		ResultEntity&lt;ResultPage&lt;List&lt;${table.capitalTableName}Form&gt;&gt;&gt; resultEntity = this.${table.humpTableName}Service.pageQuery${table.capitalTableName}s(pageQueryRequest, params);
		if(resultEntity.isSuccess()){
			ResultPage&lt;List&lt;${table.capitalTableName}Form&gt;&gt; resultPage = resultEntity.getBusinessObject();
			return ApiResponse.ok(resultPage);
		}else{
			return ApiResponse.badRequest(resultEntity.getMessage());
		}
	}
	
	@SuppressWarnings("unchecked")
	@POST
	@Doc("创建${table.tableComment}")
	/**
	 * 创建${table.tableComment}
	 * @param ${table.humpTableName}Form ${table.tableComment}
	 * @return 操作结果
	 */
	public ApiResponse&lt;String&gt; create${table.capitalTableName}(@Doc("${table.tableComment}") ${table.capitalTableName}Form ${table.humpTableName}Form){
		this.logMethodCalled("create${table.capitalTableName}");
		this.logParamValue("${table.humpTableName}Form", ${table.humpTableName}Form);
		
		Result result = this.${table.humpTableName}Service.create${table.capitalTableName}(${table.humpTableName}Form);
		if(result.isSuccess()){
			return ApiResponse.ok(result.getMessage());
		}else{
			return ApiResponse.badRequest(result.getMessage());
		}
	}
	
	@SuppressWarnings("unchecked")
	@PATCH("/{${pkCol.CapitalColumnName}}")
	@Doc("修改${table.tableComment}")
	/**
	 * 修改${table.tableComment}
	 * @param ${table.humpTableName}Form ${table.tableComment}
	 * @return 操作结果
	 */
	public ApiResponse&lt;String&gt; update${table.capitalTableName}(@Doc("${table.tableComment}") ${table.capitalTableName}Form ${table.humpTableName}Form){
		this.logMethodCalled("update${table.capitalTableName}");
		this.logParamValue("${table.humpTableName}Form", ${table.humpTableName}Form);
		
		Result result = this.${table.humpTableName}Service.update${table.capitalTableName}(${table.humpTableName}Form);
		if(result.isSuccess()){
			return ApiResponse.ok(result.getMessage());
		}else{
			return ApiResponse.badRequest(result.getMessage());
		}
	}
	
	@SuppressWarnings("unchecked")
	@GET("/{${pkCol.CapitalColumnName}}")
	@Doc("获取${table.tableComment}")
	/**
	 * 获取${table.tableComment}
	 * @param ${pkCol.CapitalColumnName} ${table.tableComment}ID
	 * @return ${table.tableComment}
	 */
	public ApiResponse&lt;${table.capitalTableName}Form&gt; get${table.capitalTableName}(@Doc("${table.tableComment}ID") @Required String ${pkCol.CapitalColumnName}){
		this.logMethodCalled("get${table.capitalTableName}");
		this.logParamValue("${pkCol.CapitalColumnName}", ${pkCol.CapitalColumnName});
		
		ResultEntity&lt;${table.capitalTableName}Form&gt; result = this.${table.humpTableName}Service.get${table.capitalTableName}(${pkCol.CapitalColumnName});
		if(result.isSuccess()){
			${table.capitalTableName}Form ${table.humpTableName}Form = result.getBusinessObject();
			return ApiResponse.ok(${table.humpTableName}Form);
		}else{
			return ApiResponse.badRequest(result.getMessage());
		}
	}
	
	@SuppressWarnings("unchecked")
	@DELETE("/{${pkCol.CapitalColumnName}}")
	@Doc("删除${table.tableComment}")
	/**
	 * 删除${table.tableComment}
	 * @param ${pkCol.CapitalColumnName} ${table.tableComment}ID
	 * @return 操作结果
	 */
	public ApiResponse&lt;String&gt; delete${table.capitalTableName}(@Doc("${table.tableComment}ID") @Required String ${pkCol.CapitalColumnName}){
		this.logMethodCalled("delete${table.capitalTableName}");
		this.logParamValue("${pkCol.CapitalColumnName}", ${pkCol.CapitalColumnName});
		
		Result result = this.${table.humpTableName}Service.delete${table.capitalTableName}(${pkCol.CapitalColumnName});
		if(result.isSuccess()){
			return ApiResponse.ok(result.getMessage());
		}else{
			return ApiResponse.badRequest(result.getMessage());
		}
	}
}
</pre>